STRING$ Function ---------------------------------------------------------------------------- Action Returns a string whose characters all have a given ASCII code or whose characters are all the first character of a string expression. Syntax 1 STRING$( m%, n%) Syntax 2 STRING$( m%, stringexpression$) Remarks The STRING$ function uses the following arguments. ----------------------------------------------------------------------------- Argument Description ---------------------------------------------------------------------------- m% A numeric expression indicating the length of the string to return. n% The ASCII code of the character to Argument Description ---------------------------------------------------------------------------- n% The ASCII code of the character to use to build the string. It is a numeric expression that BASIC converts to an integer value between 0 and 255, inclusive. stringexpression$ The string expression whose first character is used to build the return string. Examples The first example uses STRING$ to create part of a report heading. Dash$ = STRING$(10,45) PRINT Dash$;"MONTHLY REPORT";Dash$ Output ----------MONTHLY REPORT---------- This example uses STRING$ to generate a bar graph. PRINT TAB(7);"Daily Mean Temperature in Seattle" . PRINT ' Read and graph data for each month. FOR Month = 1 TO 12 STEP 2 READ Month$, Temp ' Print Temp-35 stars. PRINT Month$;" +"; STRING$(Temp-35,"*") PRINT " |" NEXT Month ' Print horizontal line. PRINT " +"; FOR X = 1 TO 7 PRINT "----+"; NEXT X PRINT ' Print temperature labels. FOR X = 4 TO 39 STEP 5 PRINT TAB(X); X+31; NEXT X PRINT DATA Jan, 40, Mar, 46, May, 56 DATA Jul, 66, Sep, 61, Nov, 46 Output Daily Mean Temperature in Seattle Jan +***** | Mar +*********** | May +********************* | Jul +******************************* | Sep +************************** | Nov +*********** | +----+----+----+----+----+----+----+ 35 40 45 50 55 60 65 70